package com.elisoft.emlap.agentmember.service;

import com.elisoft.emlap.common.Result;
import com.elisoft.emlap.domain.AgentAppGoods;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import java.util.Arrays;
import java.util.List;

@Service
public class AgentAppGoodsAPIService {

//        private static final String AGENT_APP_GOODS_URL = "http://emlap-app-goods/agent/appGoods/list";
    private static final String AGENT_APP_GOODS_URL = "http://zuul-server/api-goods/agent/appGoods/list?token=123";

    @Autowired
    private RestTemplate restTemplate;

    public Result findList(AgentAppGoods agentAppGoods) {
//        AgentAppGoods[] goods = restTemplate.getForObject(AGENT_APP_GOODS_URL, AgentAppGoods[].class);
//        List<AgentAppGoods> list = Arrays.asList(goods);
        Result result = restTemplate.getForObject(AGENT_APP_GOODS_URL, Result.class);

        return result;
    }

}
